package com.sangu.dianxiu.ui;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.sangu.dianxiu.utils.AppManager;

/**
 * Created by Administrator on 15-10-9.
 */
public class BaseActivity extends FragmentActivity {
    //app中所有Activity的基类，用以实现Activity的统一管理
    RequestQueue requestQueue;

    public RequestQueue getRequestQueue() {
        if(requestQueue==null)
        {
            requestQueue=Volley.newRequestQueue(this);
        }
        return requestQueue;
    }
    //当创建Activity的时候将Activity加入栈已进行管理
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestQueue= Volley.newRequestQueue(this);
        AppManager.getAppManager().addActivity(this);
    }


    //当按返回键的时候结束Activity
    @Override
    public void onBackPressed() {
        super.onBackPressed();
        AppManager.getAppManager().finishActivity();
    }
}
